﻿namespace Framework.Models
{
    /// <summary>
    ///  管理员
    /// </summary>
    public struct AdminType
    {
        /// <summary> 全部人员可以审批 </summary>
        public const string SuperAdmin = "-1";
        public const string Admin = "1";
    }
    /// <summary>
    ///  审批人节类型
    /// </summary>
    public struct ApprovalType
    {
        /// <summary> 全部人员可以审批 </summary>
        public const string all = "all";

        /// <summary> 指定人员 </summary>
        public const string user = "user";

        /// <summary> 指定角色 </summary>
        public const string assign_role = "assign_role";

        /// <summary> 指定负责人 </summary>
        public const string assign_leader = "assign_leader";

        /// <summary> 指定部门 </summary>
        public const string assign_org = "assign_org";
    }

    public struct Define
    {
        public const string USERROLE = "UserRole";       //用户角色关联KEY
        public const string ROLERESOURCE = "RoleResource";  //角色资源关联KEY
        public const string USERORG = "UserOrg";  //用户机构关联KEY
        public const string ROLEELEMENT = "RoleElement"; //角色菜单关联KEY
        public const string ROLEMODULE = "RoleModule";   //角色模块关联KEY
        public const string ROLEDATAPROPERTY = "RoleDataProperty";   //角色数据字段权限

        public const string DBTYPE_SQLSERVER = "SqlServer";    //sql server
        public const string DBTYPE_MYSQL = "MySql";    //mysql
        public const string DBTYPE_ORACLE = "Oracle";    //oracle

        /// <summary> 流程结束编号 </summary>
        public const string FlowEndCode = "-1";

        /// <summary> 流程结束 </summary>
        public const string FlowEndTitle = "流程结束";
    }

    /// <summary>
    /// 流程状态
    /// </summary>
    public struct FlowInstanceStatus
    {
        /// <summary>撤销、召回</summary>
        public const int Draft = -1;

        /// <summary> 正在运行</summary>
        public const int Running = 0;

        /// <summary> 完成 </summary>
        public const int Finished = 1;

        /// <summary> 不同意 </summary>
        public const int Disagree = 3;

        /// <summary> 驳回  </summary>
        public const int Rejected = 4;
    } 
    /// <summary>
    /// -1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
    /// </summary>
    public struct FlowNodeStatus
    {
        /// <summary>节点不可用</summary>
        public const int Invalid = -1;

        /// <summary> 会签开始</summary>
        public const int Fork = 0;

        /// <summary>会签结束</summary>
        public const int Join = 1;

        /// <summary>节点正常</summary>
        public const int Normal = 2;

        /// <summary>节点结束</summary>
        public const int FlowEnd = 3;
    }

    /// <summary>
    ///  分支条件 数值型字段比较
    /// </summary>
    public struct DataCompare
    {
        public const string Larger = "gt";//> 大于
        public const string Less = "lt"; // < 小于
        public const string LargerEqual = "gte"; //>= 大于等于
        public const string LessEqual = "lte";//<= 小于等于
        public const string NotEqual = "!="; //不等于
        public const string Equal = "eq";//=等于
    }
    /// <summary>
    /// 节点执行结果标签
    /// </summary>
    public class OptionResultTag
    {
        /// <summary>
        ///  1: 通过
        ///  2：不通过
        ///  3：驳回
        /// </summary>
        public int Taged { get; set; }

        /// <summary>
        /// 审核人id
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 审核人名称
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 审核人意见
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime TagedTime { get; set; }
    }
    /// <summary>
    /// 审批者
    /// </summary>
    public class Approver
    { 
        public string UserId { get; set; }
        public string UserName { get; set; }
        public string Email { get; set; } 
        public int DepartmentId { get; set; } 
        /// <summary>
        /// 是否在职
        /// </summary>
        public bool IsOnduty { get; set; }
        public string SerialNumber { get; set; }
    }
    /// <summary>
    /// 流程实例注册
    /// </summary>
    public class RegisterFlow
    {
        public string flowSchemeId { get; set; }

        public string flowInstanceId { get; set; }
        public string flowInstanceName { get; set; }
        public string frmData { get; set; }

        public int FlowLevel { get; set; }
        
        public string applyUserName { get; set; }
        public string applyUserId { get; set; }
    }
    /// <summary>
    /// 流程节点 条件
    /// </summary>
    public class ConditionFrmDataConf
    {
        public string? fieldName { get; set; }

        public string? fieldType { get; set; }
    }
     
    /// <summary>
    /// 节点执行人
    /// </summary>
    public class Nodedesignatedata
    {
        public string[] users { get; set; }
        public string[] roles { get; set; }
        public string[] orgs { get; set; }
    }
}